<%--
  Created by IntelliJ IDEA.
  User: RuoLi
  Date: 2023/3/6
  Time: 10:25
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>发送通知</title>
    <!-- import CSS -->
    <link rel="stylesheet" href="<%=request.getContextPath()%>/css/index.css">
    <!-- import Vue before Element -->
    <script src="<%=request.getContextPath()%>/js/vue.js"></script>
    <!-- import JavaScript -->
    <script src="<%=request.getContextPath()%>/js/element-ui.js"></script>
    <!-- axios -->
    <script src="<%=request.getContextPath()%>/js/axios.js"></script>
    <%--icon--%>
    <link rel="stylesheet" href="<%=request.getContextPath()%>/css/fonts/element-icons.ttf">
    <link rel="stylesheet" href="<%=request.getContextPath()%>/css/fonts/element-icons.woff">
</head>
<body>
<div id="app">
    <el-page-header @back="goBack" content="发送通知"></el-page-header>
    <el-divider></el-divider>
    <el-row>
        <el-col :span="12">
            <el-form ref="form" :model="form" label-width="80px">
                <el-form-item label="消息标题">
                    <el-select v-model="form.tipTitle" placeholder="请选择">
<%--                        <el-option label="内容编辑" value="内容编辑"></el-option>--%>
                        <el-option label="帮助提示" value="帮助提示"></el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="消息内容">
                    <el-input type="textarea" v-model="form.tipContext"></el-input>
                </el-form-item>
                <el-form-item>
                    <el-button type="primary" @click="onSubmit">立即创建</el-button>
                </el-form-item>
            </el-form>
        </el-col>
    </el-row>
</div>

</body>
<script>
    new Vue({
        el: "#app",
        data() {
            return {
                form: {
                    tipTitle: '',
                    tipContext: ''
                }
            }
        },
        methods: {
            goBack() {
                window.location.href = "/online_website/admin/index_admin.jsp";
            },
            onSubmit() {
                //发送数据
                axios({
                    url: "/online_website/common/log/InsertMessage",
                    method: "get",
                    contentType: "application/json",
                    params: {
                        tipTitle: this.form.tipTitle,
                        tipContext: this.form.tipContext,
                    }
                }).then((res) => {
                    if (res.data === 1) {
                        this.$message({
                            message: '发送成功',
                            type: 'success'
                        });
                    } else {
                        this.$message.error('发送失败');
                    }
                })
            },
        },
        created() {

        }
    })
</script>
</html>
